<div id="<?php echo sfConfig::get('app_windows_invoice_panel_id')?>">
  <div class="module_title">Create Customer Invoice for <?php echo $contact->getListName();?></div>
  <?php echo form_tag_for($invoiceForm,$invoiceForm->getUrl(),array('id'=>'formInvoice',))?>
  <?php if($documentForm->hasErrors() || $invoiceForm->hasErrors() || $invoiceAmountsForm->hasErrors()):?>
    <ul class="error_list"><li>Errors on form</ul>
  <?php endif;?>
  <?php echo $documentForm->renderGlobalErrors();?>
  <?php echo $invoiceForm->renderGlobalErrors();?>
  <?php echo $invoiceAmountsForm->renderGlobalErrors();?>
  <font color="#FF0000"><?php echo $error_message;?></font>
  <table>
    <tr>
      <td style="vertical-align:top;">
        <?php include_partial('invoice_form',array('documentForm'=>$documentForm,'invoiceForm'=>$invoiceForm,));?>
      </td>
      <td style="vertical-align: top;">
        <div class="separator">Charges:</div>
        <div id="<?php echo sfConfig::get('app_windows_invoice_amount_form_id')?>">
          <?php include_partial('invoice_amount_form',array('invoiceAmountsForm'=>$invoiceAmountsForm,));?>
        </div>
      </td>
    </tr>
  </table>
  <div class="form_buttons">
    <input type="submit" value="Save" id="invoiceSaveButton"/> |
    <input type="reset" value="Reset" id="invoiceResetButton"/>
  </div>
  </form>
</div>

<script language="javascript">
  $(document).ready(
    function(){
      $("#formInvoice").submit(
        function(){
          invoiceFormSubmit();
          return false;
        }
      );
    }
  );
</script>